Get new incident ID after merging with original incident.

Hi,
We have an internal system that can recognize when there is a problem with it system. When it recognizes such a problem, it creates a new event in pager duty. As a result, a new incident is automatically created. I do, however, want incidents to be automatically consolidated by pager duty to another incident. Once a particular incident has been merged with another incident, I want to know about it so I can keep that new ID and perform API calls on my alert. Is there any API I can use to know what is the new incident ID of my alert? Because after the incident ID was updated in pager duty with the merged one, I can’t perform basic APIs on the Alert because any such action requires the incident ID from me, and when I specify the original incident ID I accept that “no such incident id exists”.

Thanks,
Liron.

Hi Liron!

You’re right. The ability to locate the alert from the /incidents endpoint can be difficult if you are unsure which incident the alert was moved into.

I found the /log_entries endpoint to display both the active incident and alert if I searched for the /log_entries where the type was link_log_entry:

"log_entry": {
    "id": "REDACTED",
    "type": "link_log_entry",
    "summary": "Alert REDACTED added by Geeth",
    "self": "https://api.pagerduty.com/log_entries/REDACTED",
    "html_url": null,
    "created_at": "2020-04-30T14:07:40Z",
    "agent": {
      "id": "REDACTED",
      "type": "user_reference",
      "summary": "Geeth",
      "self": "https://api.pagerduty.com/users/REDACTED",
      "html_url": "https://REDACTED.pagerduty.com/users/REDACTED"
    },
    "channel": {
      "type": "website"
    },
    "service": {
      "id": "REDACTED",
      "type": "service_reference",
      "summary": "REDACTED",
      "self": "https://api.pagerduty.com/services/REDACTED",
      "html_url": "https://REDACTED.pagerduty.com/services/REDACTED"
    },
    "incident": {
      "id": "REDACTED",
      "type": "incident_reference",
      "summary": "REDACTED",
      "self": "https://api.pagerduty.com/incidents/REDACTED",
      "html_url": "https://REDACTED.pagerduty.com/incidents/REDACTED"
    },
    "teams": [],
    "contexts": [],
    "linked_incident": {
      "id": "REDACTED",
      "type": "alert_reference",
      "summary": "REDACTED",
      "self": "https://api.pagerduty.com/alerts/REDACTED",
      "html_url": "https://REDACTED.pagerduty.com/alerts/REDACTED"
    },
    "grouping_reason": "manual-move-to-existing-incident"
  }
}

The linked_incident.id contained the alert ID and the incident.ID contained the incident ID that the alert was moved to.

Thank you Greeth for the quick reply.
I checked the API you provided, and in order to use it I need my alert ID (not the dedup key):

https://api.pagerduty.com/log_entries/{id}

since I don’t know what is my alert id ( unfortunately I do not receive it in the response after creating an event via 'Event API V2) .
Which means I need to use this ‘Get Alert’ API https://api.pagerduty.com/incidents/{id}/alerts/{alert_id}

to find my alert ID. To use this API I also need an Incident ID that I do not know what it is.
So I feel that there is a rolling of actions that I do not go out of.

Do you have any other solution for me ?
Thanks, Liron.

Hi Liron,

If you have the dedup_key, can’t you query /incidents and use it as a query param? Unfortunately, the names are different, but with the incident_key param you can specify the dedup key. I’m less familiar with our Alerts APIs.